<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>我的文件</title>
</head>
<body>
<p>共<span th:text="${#arrays.length(files)}"></span>个文件， <span th:text="${#arrays.length(dirs)}"></span>个目录| <a th:href="@{/}">返回首页</a></p>
<p><a th:href="@{/previousdir(dirname=${currentdir})}">返回上一级目录</a></p>

<div>
	<form action="/chooseWinRoot" method="post">
		<select name="winRoot">
    		<option value="">请选择盘符</option>
    		<option th:each="winRoot : ${winRoots}" th:value="${winRoot}" th:text="${winRoot}"></option>
		</select>
		<input type="submit" value="切换盘符"/>
	</form>
</div>
<hr/>
<div>
	<table>
            <thead>
            <tr>
                <th>#</th>
                <th>文件名</th>
                <th>下载/进入</th>
                <th>删除</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="filename, fileStat : ${files}">
            	<td th:text="${fileStat.index}"></td>
                <td th:text="${filename}"></td>
                <!-- thymeleaf 传递多个参数 -->
                <td><a th:href="@{/blu/download/{filename}(filename=${filename},filepath=${currentdir})}">点击下载</a></td>
                <td>
                	<form action="/blu/deleteFile" method="post">
						<input type="hidden" name="filename" th:value="${filename}"/>
						<input type="hidden" name="dirname" th:value="${currentdir}"/>
						<input type="submit" value="删除文件"/>
					</form>
                </td>
            </tr>
            <tr th:each="dirname, dirStat : ${dirs}">
            	<td th:text="${dirStat.index}"></td>
                <td th:text="${dirname}"></td>
                <td><a th:href="@{/mydir(dirname=${dirname})}">点击进入</a></td>
            </tr>
            </tbody>
	</table>
	<hr/>
	<form action="uploadToWindows" method="post" enctype="multipart/form-data" target="targetIfr">
		<input type="file" name="file" id="fileToUpload"/>
		<input type="hidden" name="dirname" th:value="${currentdir}"/>
		<input type="submit" id="fileToUploadSubmit" value="上传文件"/>
	</form>
	<iframe id="targetIfr" name="targetIfr" style="display:none"></iframe>
</div>

</body>
</html>